package zzr.library.db.common;

import android.content.Context;

import androidx.room.Database;
import androidx.room.Room;

public class DBUtil {
    private static volatile AppDatabase appDatabase;

    public static AppDatabase getAppDatabase(Context context) {
        if (appDatabase == null) {
            synchronized (DBUtil.class) {
                if (appDatabase == null) {
                    appDatabase = Room.databaseBuilder
                            (context, AppDatabase.class, "library-table")
//                            .createFromAsset("library-table")
                            .allowMainThreadQueries()
                            .build();
                }

            }
        }
        return appDatabase;
    }
}
